package com.extremelylargepackage.entity;

import android.util.Log;

import com.extremelylargepackage.sprite.AbstractSprite;
import com.extremelylargepackage.sprite.Animation;

public class EntityFactory 
{
	public static Entity createEntity(EntityType type)
	{
		if(type == EntityType.enemy)
			return new Enemy();
		if(type == EntityType.weapon)
			return new Weapon();
		if(type == EntityType.projectile)
			return new Projectile();
		if(type == EntityType.beamWeapon)
			return new BeamWeapon();
		return null;
	}
	
	public static void setLocation(Entity entity, int x, int y)
	{
		entity._locX = x;
		entity._locY = y;
	}
	
	public static void setSpeed(Entity entity, int speed)
	{
		entity._speed = speed;
	}
	
	public static void setName(Entity entity, String name)
	{
		entity._name = name;
	}
	
	public static void setWeaponProperties(Weapon weapon, float fireRate, Projectile projectile)
	{
		weapon._fireRate = fireRate;
		weapon.setProjectiles(projectile);
	}
	
	public static void setBeamWeaponProperties(BeamWeapon weapon, int beamLength)
	{
		weapon._beamLength = beamLength;
	}
	
	public static void SetWeaponOwner(Weapon weapon, Character owner)
	{
		weapon._owner = owner;
	}
	
	public static void setProjectileProperties(Projectile projectile, float speed, AbstractSprite sprite, float damage, int pierceDepth)
	{
		projectile._speed = speed;
		projectile._sprite = sprite;
		projectile._damage = damage;
		projectile._pierceDepth = pierceDepth;
	}
	
	public static void setEnemyProperties(Enemy enemy, float speed, Weapon weapon, float health, Animation explosion, int collisionDamage)
	{
		enemy._speed = speed;
		enemy._weapon = weapon;
		enemy._health = health;
		enemy._maxHealth = health;
		enemy._explosionAnim = explosion;
		enemy._collisionDamage = collisionDamage;
	}
	
	public static void setEnemyAi(Enemy enemy, ArtificialIntelligence ai)
	{
		enemy._ai = ai;
	}
	
	public static void setSprite(Entity entity, AbstractSprite sprite)
	{
		entity._sprite = sprite;
	}
	
	public enum EntityType
	{
		enemy,
		weapon,
		beamWeapon,
		projectile,
		dialog
	}
}

